<template>
  <div class="app-container">
    <!--表单-->
    <el-form :inline="true" class="demo-form-inline">

       <el-select v-model="type" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>

      <el-button
        @click="spiderData()">生成</el-button>
    </el-form>

  </div>
</template>

<script>
import spider from '@/api/spider/spider'

export default {
     data() {
        return {
          options: [{
            value: 1,
            label: '爬取全球各国疫情数据'
          }, {
            value: 2,
            label: '爬取全国各地区疫情数据'
          }, {
            value: 3,
            label: '爬取疫情最新通报数据'
          }, {
            value: 4,
            label: '爬取实时资讯通用数据'
          }, {
            value: 5,
            label: '爬取科大最新新闻'
          }],
          type:1
        }
      },

  methods: {
    spiderData() {
      spider.spiderData(this.type)
      .then(response => {
        this.$message({
          type: 'success',
          message: '爬取成功'
        })
      })
      .catch(error =>{
        console.log(error)
      })
    }
  }
}
</script>

<style>
</style>
